require.config({
    paths: {
        echarts: 'http://echarts.baidu.com/build/dist'
    }
});
var bar_option = {
    title : {
        text: '活跃人数变化情况',
        subtext: '4-9月'
    },
    tooltip : {
        trigger: 'axis',
        axisPointer : {            // 坐标轴指示器，坐标轴触发有效
            type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
        }
    },
    grid:{
       width:500
    },
    legend: {
        data:['已完成','进行中','未开始'],
        orient: 'vertical', // 'vertical'
        x: '700', // 'center' | 'left' | {number},
        y: '100',// 'center' | 'bottom' | {number}
        padding:200,
        itemGap:16
    },
    toolbox: {
        show : false,
        orient: 'vertical',
        x: 'right',
        y: 'center',
        feature : {
            mark : {show: true},
            dataView : {show: true, readOnly: false},
            magicType : {show: true, type: ['line', 'bar', 'stack', 'tiled']},
            restore : {show: true},
            saveAsImage : {show: true}
        }
    },
    calculable : true,
    xAxis : [
        {
            type : 'category',
            data : ['周一','周二','周三','周四','周五','周六']
        }
    ],
    yAxis : [
        {
            type : 'value'
        }
    ],
    series : [
        
        {
            name:'已完成',
            type:'bar',
            stack: '广告',
            barWidth : 27,
            color:'#22b0b2',
            data:[120, 132, 101, 134, 90, 230]
        },
        {
            name:'进行中',
            type:'bar',
            stack: '广告',
            barWidth : 27,
             color:'#22b0b2',
            data:[220, 182, 191, 234, 290, 330]
        },
        {
            name:'未开始',
            type:'bar',
            stack: '广告',
            barWidth : 27,
            data:[150, 232, 201, 154, 190, 330]
        }      
        
    ]
};
var line_option = {
    title : {
        text: '活跃人数变化情况',
        subtext: '4-9月'
    },
    tooltip : {
        trigger: 'axis'
    },
    legend: {
        data:['A股指数','总资产']
    },
    toolbox: {
        show : true,
        feature : {
            // mark : {show: true},
            // dataView : {show: true, readOnly: false},
            magicType : {show: true, type: ['line', 'bar']},
            restore : {show: true},
            saveAsImage : {show: true}
        }
    },
    calculable : true,
    xAxis : [
        {
            type : 'category',
            boundaryGap : false,
            axisLabel:{},
            data : ['4','5','6','7','8','9']
        }
    ],
    yAxis : [
        {
            type : 'value',
            axisLabel : {
                formatter: '{value}% '
            },
            // min:150000,
            // scale:true,
            // max:240000
        }
    ],
    series : [
        {
            name:'A股指数',
            type:'line',
            data:[ 11, 15, 13, 12, 13, 10],
            // markPoint : {
            //     data : [
            //         {type : 'max', name: '最大值'},
            //         {type : 'min', name: '最小值'}
            //     ]
            // },
            // markLine : {
            //     data : [
            //         {type : 'average', name: '平均值'}
            //     ]
            // },
            smooth:'true'
            // smooth:true;
        },
        {
            name:'总资产',
            type:'line',
            data:[ 11, 15, 13, 12, 13, 10],
            // markPoint : {
            //     data : [
            //         {type : 'max', name: '最大值'},
            //         {type : 'min', name: '最小值'}
            //     ]
            // },
            // markLine : {
            //     data : [
            //         {type : 'average', name: '平均值'}
            //     ]
            // },
            smooth:'true'
            // smooth:true;
        }
    ]
};


var lv2_line_option = {
    title : {
        text: '各股每日收益对比',
        subtext: '4-9月'
    },
    tooltip : {
        trigger: 'axis'
    },
    legend: {
        data:['招商证券','人民网','本钢板材','云南铜业','天神娱乐','中孚实业']
    },
    toolbox: {
        show : true,
        feature : {
            // mark : {show: true},
            // dataView : {show: true, readOnly: false},
            magicType : {show: true, type: ['bar', 'line']},
            restore : {show: true},
            saveAsImage : {show: true}
        }
    },
    calculable : true,
    xAxis : [
        {
            type : 'category',
            boundaryGap : false,
            data : ['4','5','6','7','8','9']
        }
    ],
    yAxis : [
        {
            type : 'value',
            axisLabel : {
                formatter: '{value}'
            },
            // min:150000,
            // scale:true,
            // max:240000
        }
    ],
    series : [
        {
            name:'招商证券',
            type:'bar',
            data:[ 11, 15, 13, 12, 13, 10],
            smooth:'true',
           
            
            // smooth:true;
        },
        {
            name:'人民网',
            type:'bar',
            data:[ 11, 15, 13, 12, 13, 10],
            smooth:'true'
        },        {
            name:'本钢板材',
            type:'bar',
            data:[ 11, 15, 13, 12, 13, 10],
            smooth:'true'
            // smooth:true;
        },
        {
            name:'云南铜业',
            type:'bar',
            data:[ 11, 15, 13, 12, 13, 10],
            smooth:'true'
        },        {
            name:'天神娱乐',
            type:'bar',
            data:[ 11, 15, 13, 12, 13, 10],
            smooth:'true'
            // smooth:true;
        },
        {
            name:'中孚实业',
            type:'bar',
            data:[ 11, 15, 13, 12, 13, 10],
            smooth:'true', itemStyle:{normal:{color:'#FF4040'}}
        }
    ]
};

var option = {
    tooltip : {
        trigger: 'item',
        formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    legend: {
        orient : 'vertical',
        x : 'left',
        data:['未完成','已完成']
    },
    toolbox: {
        show : true,
        feature : {
            mark : {show: true},
            dataView : {show: true, readOnly: false},
            magicType : {
                show: true, 
                type: ['pie', 'funnel'],
                option: {
                    funnel: {
                        x: '25%',
                        width: '50%',
                        funnelAlign: 'center',
                        max: 1548
                    }
                }
            },
            restore : {show: true},
            saveAsImage : {show: true}
        }
    },
    calculable : true,
    color:[ '#ff7f50', '#87cefa', '#da70d6', '#32cd32', '#6495ed'],
    series : [
        {
            name:'课程',
            type:'pie',
            radius : ['40%', '70%'],
            itemStyle : {
                normal : {
                    label : {
                        show : false
                    },
                    labelLine : {
                        show : false
                    }
                },
                emphasis : {
                    label : {
                        show : true,
                        position : 'center',
                        textStyle : {
                            fontSize : '30',
                            fontWeight : 'bold'
                        }
                    }
                }
            },
            data:[
                {value:750, name:'未完成',itemStyle:{normal:
                    {color:'#1a7071',label:{show:true,position:'inside',formatter: '75%',textStyle:{fontSize:24}}}}
                },
                {value:250, name:'已完成',itemStyle:{normal:{color:'#22b0b2',label:{show:true,position:'inside',formatter: '25%',textStyle:{fontSize:24}}}}}
            ]
        }
    ]
};

 var circle_option = {
    tooltip : {
        trigger: 'item',
        formatter: "{a} <br/>{b} : {c} ({d}%)"
    },
    legend: {
        orient : 'vertical',
        x : 'left',
        data:['已完成','进行中','未开始','课程A','课程B','课程C','视频课程','百度课程','谷歌课程','必应课程']
        // data:['课程A','课程B','课程C','视频课程','百度课程','谷歌课程','必应课程']
    },
    // toolbox: {
    //     show : true,
    //     feature : {
    //         mark : {show: true},
    //         dataView : {show: true, readOnly: false},
    //         magicType : {
    //             show: true, 
    //             type: ['pie', 'funnel']
    //         },
    //         restore : {show: true},
    //         saveAsImage : {show: true}
    //     }
    // },
    calculable : false,
    series : [
        {
            name:'人数',
            type:'pie',
            selectedMode: 'single',
            radius : [0, 70],
            
            // for funnel
            x: '20%',
            width: '40%',
            funnelAlign: 'right',
            max: 1548,
            
            itemStyle : {
                normal : {
                    label : {
                        position : 'inner'
                    },
                    labelLine : {
                        show : false
                    }
                }
            },
            data:[
                {value:335, name:'已完成',itemStyle:{normal:{color:'#eb8cbb'}}},
                {value:679, name:'进行中',itemStyle:{normal:{color:'#c761e4'}}},
                {value:1548, name:'未开始',itemStyle:{normal:{color:'#8c61e4'}}}
            ]
        },
        {
            name:'人数',
            type:'pie',
            radius : [100, 140],
            
            // for funnel
            x: '60%',
            width: '35%',
            funnelAlign: 'left',
            max: 1048,
            
            data:[
                {value:335, name:'课程A',itemStyle:{normal:{color:'#22b0b2'}}},
                {value:310, name:'课程B',itemStyle:{normal:{color:'#22b0b2'}}},
                {value:234, name:'课程C',itemStyle:{normal:{color:'#22b0b2'}}},
                {value:135, name:'视频课程'},
                {value:1048, name:'百度课程'},
                {value:251, name:'谷歌课程'},
                {value:147, name:'必应课程'}
            ]
        }
    ]
};


var basic_bar_option = {
    title : {
        text: '某地区蒸发量和降水量',
        subtext: '纯属虚构'
    },
    tooltip : {
        trigger: 'axis'
    },
    legend: {
        data:['蒸发量','是是是']
    },
    toolbox: {
        show : true,
        feature : {
            // mark : {show: true},
            // dataView : {show: true, readOnly: false},
            magicType : {show: true, type: ['line', 'bar']},
            restore : {show: true},
            saveAsImage : {show: true}
        }
    },
    calculable : true,
    xAxis : [
        {
            type : 'category',
            data : ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月'],
            axisLabel:{
                show:true,
                interval:10,
                rotate:0
                    }
        }
    ],
    yAxis : [
        {
            type : 'value',
            // max:100
        }
    ],
    series : [
        {
            name:'蒸发量',
            type:'bar',
            data:[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3],
            barWidth : 2,
            markPoint : {
                data : [
                    {type : 'max', name: '最大值'},
                    {type : 'min', name: '最小值'}
                ]
            },
            markLine : {
                data : [
                    {type : 'average', name: '平均值'}
                ]
            }
        },        {
            name:'蒸发量',
            type:'bar',
            data:[2.0, 4.9, 7.0, 23.2, 25.6, 76.7, 135.6, 162.2, 32.6, 20.0, 6.4, 3.3],
            barWidth : 2,
            markPoint : {
                data : [
                    {type : 'max', name: '最大值'},
                    {type : 'min', name: '最小值'}
                ]
            },
            markLine : {
                data : [
                    {type : 'average', name: '平均值'}
                ]
            }
        }
    ]
};

var bar_option2 = {
    title : {
        text: '世界人口总量',
        subtext: '数据来自网络'
    },
    tooltip : {
        trigger: 'axis'
    },
    legend: {
        data:['2011年']
    },
    toolbox: {
        show : true,
        feature : {
            mark : {show: true},
            dataView : {show: true, readOnly: false},
            magicType: {show: true, type: ['line', 'bar']},
            restore : {show: true},
            saveAsImage : {show: true}
        }
    },
    calculable : true,
    xAxis : [
        {
            type : 'value',
            boundaryGap : [0, 0.01],
            max:100,
            axisLabel:{
                show:true,
                interval:0,
                rotate:0
                    }
        }
    ],
    yAxis : [
        {
            type : 'category',
            data : ['巴西','印尼','美国','印度','中国','世界人口(万)'],
            axisLabel:{
                show:true,
                interval:0
            }
        }
    ],
    series : [
        {
            name:'2011年',
            type:'bar',
            // barWidth:10,
            data:[18203, 23489, 29034, 104970, 131744, 630230]
        }
    ]
};


